#include <iostream>
#include <algorithm>

using namespace std;

string path;

void add(int x)
{
	string tmp;
	while(x)
	{
		int y = x % 10;
		if(y == 2 || y == 0 || y == 3) tmp.push_back(y + '0');
		x /= 10;
	}
	reverse(tmp.begin(), tmp.end());
	path += tmp;
}

int main()
{
	for(int i = 1; i <= 2023; i++)
	{
		add(i);
	}
//	cout << path << endl;
	long long cnt = 0;
	for(int i = 0; i < path.size(); i++)
	{
		if(path[i] != '2') continue;
		for(int j = i + 1; j < path.size(); j++)
		{
			if(path[j] != '0') continue;
			for(int p = j + 1; p < path.size(); p++)
			{
				if(path[p] != '2') continue;
				for(int q = p + 1; q < path.size(); q++)
				{
					if(path[q] == '3') cnt++;
				}
			}
		}
	}
	cout << cnt << endl;
	return 0;
}
